package com.hmall.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hmall.user.mapper.AddressMapper;
import com.hmall.user.pojo.Address;
import com.hmall.user.service.IAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AddressService extends ServiceImpl<AddressMapper, Address> implements IAddressService {
     @Autowired
    private AddressMapper addressMapper;

    @Override
    public Address selectId(Long id) {
        Address address = addressMapper.selectById(id);
        return address;
    }

    @Override
    public List<Address> selectlist(Long userid) {
        QueryWrapper<Address> queryWrapper = new QueryWrapper<>();
        queryWrapper.gt("user_id",userid);
        List<Address> addresses = addressMapper.selectList(queryWrapper);
        return addresses;
    }
}